<?php 
class UserCenterAction extends Action
{
	public function index()
	{
		$result=$this->queryVideo();
		$this->videolist = $result['list'];
		$this->page=$result['page'];
		$this->display();	
	}
	public function manageVideo()
	{
		$result=$this->queryVideo();
		$this->videolist = $result['list'];
		$this->page=$result['page'];
		$this->display();
	}
	public function deleteVideo()
	{
		$videoname=$_GET['videoname'];
		$user=M('User_video');
		$user->create();
		$user->where(array('username'=>$_SESSION['username'],'videodir'=>$videoname))->delete();
		$this->redirect('manageVideo');
	}
	public function queryVideo()
	{
		$uservideo=M('User_video');
		import("ORG.Util.Page");
		$count=$uservideo->where(array('username'=>$_SESSION['username']))->count();
		$Page=new Page($count,3);
		$show=$Page->show();
		$list=$uservideo->where(array('username'=>$_SESSION['username']))->limit($Page->firstRow.','.$Page->listRows)->select();
		$result=array('list'=>$list,'page'=>$show);
		return $result;
	}
	
	
	
	
}
?>